package com.hsp.Demo_03_object;

public class Demo_10 {
    public static void main(String[] args) {
//        Person10 person10 = new Person10("小明",10);
        Person10 person10 = new Person10();
        System.out.println(person10.age + "-" + person10.name);
        /*
        输出结果：
            有参构造器
            无参构造器
            20-小王
         */
    }
}

class Person10{
    int age = 90;
    String name;

    public Person10(){
        this("小王", 20);
        System.out.println("无参构造器");
    }

    public Person10(String name, int age){
        this.name = name;
        this.age = age;
        System.out.println("有参构造器");
    }
}
